package com.j2eefast.flowable.bpm.service;

import com.j2eefast.common.core.base.entity.LoginUserEntity;
import com.j2eefast.common.core.utils.PageUtil;
import com.j2eefast.common.core.utils.ResponseData;
import com.j2eefast.flowable.bpm.entity.BpmModelEntity;
import com.j2eefast.flowable.bpm.entity.BpmTaskEntity;
import com.j2eefast.flowable.bpm.entity.CompleteTaskEntity;
import com.j2eefast.flowable.bpm.entity.StartProcessInstanceEntity;
import com.j2eefast.flowable.bpm.entity.output.FlowElementUserTaskEntity;
import org.apache.ibatis.annotations.Param;
import org.flowable.bpmn.model.FlowElement;
import org.flowable.bpmn.model.UserTask;

import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * 运行时任务
 */
public interface IFlowableTaskService {

	/**
	 * 查询待办任务
	 * @param params
	 * @return
	 */
	PageUtil findApplyingTasksPage(Map<String, Object> params);


	/**
	 * 查询已办任务
	 * @param params
	 * @return
	 */
	PageUtil findApplyedTasksPage(Map<String, Object> params);

	/**
	 * 执行任务
	 *
	 * @param params 参数
	 */
	ResponseData complete(CompleteTaskEntity params);


	/**
	 * 判断任务是否挂起
	 * @param processInstanceId
	 * @return
	 */
	boolean isSuspended(String processInstanceId);

	/**
	 * 获取并行流程节点
	 * @param params
	 * @return
	 */
	List<BpmTaskEntity> findApplyingParallelTasks(Map<String, Object> params);

	/**
	 * 获取流程变量
	 * @param taskId
	 * @return
	 */
	BpmModelEntity getVariables(String taskId);

	/**
	 * 根据TaskId 获取当前流程信息
	 * @param taskId
	 * @return
	 */
	Map getDataObjects(String taskId);

	/**
	 * 根据id获取流程数据
	 * @param taskId
	 * @return
	 */
	BpmTaskEntity getTasksByTaskId(String taskId);

	/**
	 * 获取下一节点信息
	 * @param taskId
	 * @return
	 */
	FlowElementUserTaskEntity nextFlowNode(String taskId);

	/**
	 * 获取当前节点信息
	 * @param taskId
	 * @return
	 */
	UserTask newFlowable(String taskId);

}
